//
// Created by eruake on 2017/8/9.
//

#include <iostream>
#include <boost/date_time.hpp>
#include <boost/asio.hpp>
#include <boost/thread/thread.hpp>

using namespace boost::posix_time;
using namespace boost::asio;


using namespace std;

void handler(const boost::system::error_code &ec)
{
    std::cout << "1 s." << std::endl;
}

void hello()
{
    std::cout<<"Hello world, I'm a thread!"<<std::endl;
}

int main()
{
    cout << "test for using boost " << endl;
    ptime now = second_clock::local_time();
    cout << now <<endl;

    boost::asio::io_service io_service;
    boost::asio::deadline_timer timer(io_service, boost::posix_time::seconds(1));
    timer.async_wait(handler);
    io_service.run();
    std::cout << "hello world"<<std::endl;

    boost::thread thrd(&hello);
    thrd.join();

    system("pause");
    return 0;
}